<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1">
	<title>爱租网_用户登录</title>
	<link rel="icon" href="_img_/logo.ico">
	{css href="_css_/login.css"} 
	{css href="_js_/layui/css/layui.css"}
	{js href="_js_/jquery2.1.4.min.js"}
	{js href="_js_/layer/layer.js"}
	{js href="_js_/layui/layui.js"}
	{js href="_js_/jquery.validate.min.js"}
	{js href="_js_/jquery.form.js"}
	{js href="_js_/messages_zh.js"}
</head>
<body>
	<div class="part1">
  </div>
		<a href="{:url('index/index/index')}"><img src="_img_/login1.png"></a>
		<span>.</span>
		<img src="_img_/login2.png">
	</div>
	<div style="height:30px"></div>
	<div class="part2">
		<form class="layui-form layui-col-xs5 layui-col-sm5 layui-col-md3 " action="javascript:;" method="post">
			<div clas="layui-input-item">
				<label class="title layui-form-label">账号登录</label>
			</div>
			<div class="layui-form-item" style="height: 50px">
				<input class="layui-input" type="text" name="user" autoconplete="off" placeholder="用户名/手机号" value="{$Think.cookie.user??''}" required>
			</div>
			<div class="layui-form-item"  style="height: 50px">
				<input class="layui-input" type="password" name="pwd" autoconplete="off" placeholder="密码" value="{$Think.cookie.pwd??''}" required rangelength=[6,16]>
			</div>
			<div class="layui-form-item">
				<input type="checkbox" name="remb" lay-skin="primary" title="记住密码" value="1">
				<div style="margin-top:12px;margin-left:110px;" class="layui-inline"><a class="layui-word-aux" href="{:url('index/login/forget')}">找回密码</a></div>
			</div>
			 <div>
			 	<button class="layui-btn" type="submit" id="submit">登&nbsp;录</button>
			 </div>
		</form>
	</div>
	<div class="part3">
		©2017 Hangzhou ishangzu Technology Co.,Ltd. All rights reserved. 备案号：浙ICP备15007224号-2浙公网安备 33010802006107号
	</div>

<script type="text/javascript">
	$().ready(function(){
		$('form').validate({
			rules:{

			},
			messages:{
				user:{
					required:'请填写用户名/手机号',
				},
				pwd:{
					required:'请填写密码',
					rangelength:'密码为6-16位任意字符组合'
				}
			},
			submitHandler:function(form){
				$(form).ajaxSubmit({
  				type:'post',
  				url:'{:url('index/login/do_login')}',
  				dataType:'text',
					success:function(res){
						res = eval('('+res+')');
						console.log(res);
						if(res.msg == '成功'){
							layer.msg('登录成功！',{icon:1,time:2000,offset: ['230px', '140px']},function(){
									location.href = '{:url('index/index/index')}'})
						}else{
							layer.msg('账号或密码错误！',{icon:2,time:2000,offset: ['230px', '140px']});
						}
					}
				})
			}
		});
	})
	

	layui.use('form', function(){
	  var form = layui.form;
	  form.render();
	});
</script>
</body>
</html>